xen: RCU: avoid busy waiting until the end of grace period.
authorDario Faggioli <dario.faggioli@citrix.com>
Wed, 30 Aug 2017 11:06:22 +0000 (12:06 +0100)
committerGeorge Dunlap <george.dunlap@citrix.com>
Wed, 30 Aug 2017 11:06:22 +0000 (12:06 +0100)
commit2b936ea7b716dc1a13c98550f81752ab053e95c0
treeeff538295f4ca7b875c3c4d1e2fac55512e4c0ef
parent38ad8151f563db9166e7b4133273ab27d8a3730e
xen: RCU: avoid busy waiting until the end of grace period.

On the CPU where a callback is queued, cpu_is_haltable()
returns false (due to rcu_needs_cpu() being itself false).
That means the CPU would spin inside idle_loop(), continuously
calling do_softirq(), and, in there, continuously checking
rcu_pending(), in a tight loop.

Let's instead allow the CPU to really go idle, but make sure,
by arming a timer, that we periodically check whether the
grace period has come to an ended. As the period of the
timer, we pick a value that makes thing look like what
happens in Linux, with the periodic tick (as this code
comes from there).

Note that the timer will *only* be armed on CPUs that are
going idle while having queued RCU callbacks. On CPUs that
don't, there won't be any timer, and their sleep won't be
interrupted (and even for CPUs with callbacks, we only
expect an handful of wakeups at most, but that depends on
the system load, as much as from other things).

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
xen/common/rcupdate.c
xen/common/schedule.c
xen/include/xen/perfc_defn.h
xen/include/xen/rcupdate.h